package week_home_work02;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/22
 */
public class Demo25 {
    public static void main(String[] args) {
        //计算从1到n的所有数字的平方和。
        Scanner sc =new Scanner(System.in);
        System.out.println("请输入一个整数:");
        int num = sc.nextInt();
        int sum = 0;
        for (int i = 1; i <= num ; i++) {
            sum += i*i;
        }
        System.out.println(sum);
    }
}
